package com.oa4.service;

import com.oa4.dao.EmpDao;
import com.oa4.dao.SignDao;
import com.oa4.pojo.Sign;
import com.oa4.util.DU;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 定时器任务控制器
 */

//@Configuration
@Component
@EnableScheduling
public class AutoCreateSign {

    @Autowired
    private ScheduledTaskService scheduledTaskService;

    /**
     * 每天凌晨2点执行清理任务
     * cron表达式: 秒 分 时 日 月 周
     * "0 0 2 * * ?" 表示在任意月份、任意周的每天的凌晨2点0分0秒执行
     */
    @Scheduled(cron = "0 40 11 * * ?")
    public void performCleanup() {
        System.out.println("【定时任务】开始执行清理任务...");
        scheduledTaskService.cleanupDeletedEmployees();
    }
}
